package et.item.drill;

import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

/**
 * Created by winston_wang on 2017/6/30.
 */
public class ETItemOrderDrill extends ETItemDrill {
    public ETItemOrderDrill() {
        super(8.0f, 80.0f, 57000, 100, 1, 10, 17.0f);
        setTextureName("et:itemVoidOrderDrill");
        setUnlocalizedName("orderVoidDrill");
    }

    @Override
    public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, Block block, int par4, int par5, int par6, EntityLivingBase par7EntityLiving) {
        int x= par4-5;
        int y = par5-5;
        int z = par6-5;
        for(int i =0;i<11;i++){
            for(int n =0;n<11;n++){
                for(int j =0;j<11;j++){
                    if(par7EntityLiving instanceof EntityPlayer) {
                        if(par2World.getBlock(x+i, y+n, z+j).canHarvestBlock((EntityPlayer) par7EntityLiving,par2World.getBlockMetadata(x+i, y+n, z+j))){
                            par2World.getBlock(x+i, y+n, z+j).harvestBlock(par2World, (EntityPlayer) par7EntityLiving, x+i, y+n, z+j, par2World.getBlockMetadata(x+i, y+n, z+j));
                            par2World.setBlockToAir(x+i, y+n, z+j);
                        }
                    }
                }
            }
        }
        return super.onBlockDestroyed(par1ItemStack,par2World, block,par4,par5,par6,par7EntityLiving);
    }
}
